For this exercise, the ResetDB stored procedure is modified by adding the NOT NULL constraint to each database field as it is created. It is best to do this for all data items in these tables, as they are either required (like the policy number and claim reference) or have a sensible default (for example 0 for the claim amount, or "" for the claim description). As noted in section 10.8, where NULL values may exist, extra care is needed to write valid database queries. Where possible, therefore, you should ensure that none may be entered. The required syntax is, for example,
CREATE TABLE claim ( ...
description VARCHAR(100) NOT NULL,
...
To view the code for the updated ResetDB procedure, use the Database Explorer, and expand the Stored Procedures node of the Database.mdf file. You can then view the procedure, or execute it, by right clicking the mouse over the stored procedure's name.